const Service = require('egg').Service;
const svgCaptcha = require('svg-captcha');
class UserService extends Service {
    // 产生验证码
    async captcha() {
        const captcha = svgCaptcha.create({
            size: 4,
            fontSize: 50,
            width: 100,
            height: 40,
            background: '#cc9966'
        });

        this.ctx.cookies.set("verify", captcha.text)
        return captcha; //返回验证码
    }
}
module.exports = UserService;